<%@page import="java.util.ArrayList"%>
<%@page import="java.util.Date"%>
<%@page import="bean.AuctionItemBean"%>
<%@page import="org.apache.jasper.tagplugins.jstl.core.ForEach"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>	
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<input type="hidden" id="countdown" value="false"/>
<c:set var="now" value="<%=(new Date()).getTime()%>"/>
<c:forEach var='bean' items="${searchedBeans}">
	<c:set var="timeLeft" value="${(bean.endTime-now)/1000}"/>
	<c:if test="${(timeLeft < 0)}">
		<c:set var="timeLeft" value="0"/>
	</c:if>
	<div class="item">
		<div class="item-pic"></div>
		<div class="item-name">
			<h1>
				<a href="javascript: doGoToAuction(${bean.auctionItemID})">${bean.title}</a>
			</h1>
		</div>
		<div class="item-time"><input type="hidden" class="item-to-time" value="${timeLeft}"/></div>
		<c:choose>
			<c:when test="${bean.topBid.time != null}">
				<div class="item-price">&euro;${bean.topBid.bidValue},-</div>
			</c:when>
			<c:otherwise>
				<div class="item-price">&euro;${bean.startPrice},-</div>
			</c:otherwise>
		</c:choose>
		
		<div class="item-desc">
			<p>${bean.description}</p>
		</div>
		<div class="item-options">
			<input name="edit" type="button" class="button" value="Edit" onclick="doGoToEdit('${bean.auctionItemID}');"/>
			<input name="delete" type="button" class="button" value="Delete" onclick="doDeleteAuctionItem('${bean.auctionItemID}')"/>
		</div>
	</div>
</c:forEach>